home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / Bomber Fortress.swf / scripts / DefineSprite_194 / frame_1 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  1.7 KB  |  75 lines

  1. my_radius = _width / "2";
  2. my_x = _X;
  3. my_y = _Y;
  4. my_n = _name;
  5. if(ymov == "")
  6. {
  7.    ymov = random(eval("/:speed")) + "1";
  8.    xmov = random(eval("/:speed")) + "1";
  9.    ysign = random("2") - "1";
  10.    if(ysign == "0")
  11.    {
  12.       ysign = "1";
  13.    }
  14.    xsign = random("2") - "1";
  15.    if(xsign == "0")
  16.    {
  17.       xsign = "1";
  18.    }
  19.    xmov *= xsign;
  20.    ymov *= ysign;
  21. }
  22. if(my_radius + eval("/:speed") >= my_x)
  23. {
  24.    xmov *= - "1";
  25.    my_x = my_radius + eval("/:speed");
  26. }
  27. if(my_radius + eval("/:speed") >= my_y)
  28. {
  29.    ymov *= - "1";
  30.    my_y = my_radius + eval("/:speed");
  31. }
  32. if(my_x >= eval("/:movie_width") - my_radius - eval("/:speed"))
  33. {
  34.    xmov *= - "1";
  35.    my_x = eval("/:movie_width") - my_radius - eval("/:speed");
  36. }
  37. if(my_y >= eval("/:movie_height") - my_radius - eval("/:speed"))
  38. {
  39.    ymov *= - "1";
  40.    my_y = eval("/:movie_height") - my_radius - eval("/:speed");
  41. }
  42. n = "1";
  43. while(eval("/:total_circles") >= n)
  44. {
  45.    if(n ne my_n)
  46.    {
  47.       n_x = getProperty("../" add n, _X);
  48.       n_y = getProperty("../" add n, _Y);
  49.       n_radius = getProperty("../" add n, _width) / "2";
  50.       delta_x = my_x + xmov - n_x;
  51.       delta_y = my_y + ymov - n_y;
  52.       if(delta_x * delta_x + delta_y * delta_y < (my_radius + n_radius) * (my_radius + n_radius))
  53.       {
  54.          if(eval("/:soundon") == "1")
  55.          {
  56.             tellTarget("/h2o")
  57.             {
  58.                play();
  59.             }
  60.          }
  61.          if(eval("/:soundon") == "1")
  62.          {
  63.             tellTarget("/ratata")
  64.             {
  65.                play();
  66.             }
  67.          }
  68.          gotoAndPlay(3);
  69.       }
  70.    }
  71.    n += "1";
  72. }
  73. _X = my_x + xmov;
  74. _Y = my_y + ymov;
  75.